package linuxbox.exception;

import linuxbox.util.*;

public class LinuxboxException extends Exception {
    public static final LinuxboxException NO_USER =
    	new LinuxboxException(ExceptionHelper.SYSTEM, "S000009");
    public static final LinuxboxException TIMEOUT =
    	new LinuxboxException(ExceptionHelper.SYSTEM, "S000010");
    public static final LinuxboxException LOGIN_ERROR =
    	new LinuxboxException(ExceptionHelper.SYSTEM, "S000011");
    public static final LinuxboxException FAIL_CHANG_PASSWD =
    	new LinuxboxException(ExceptionHelper.ADMIN, "A000001");
    public static final LinuxboxException DBADAPTER_ERROR =
    	new LinuxboxException(ExceptionHelper.SYSTEM, "S000012");
    public static final LinuxboxException ACCESS_VIOLATION =
            new LinuxboxException(ExceptionHelper.SYSTEM, "S000013");
	/**
	 * Status Exceptions
	 *
	 */
	public static final LinuxboxException ALREADY_CHECKIN =
	    new LinuxboxException(ExceptionHelper.STATUS, "U000003");

	protected int m_iExceptionType;
	protected String m_sErrorID;

	public LinuxboxException() {
		super();
		m_iExceptionType = WebTools.UNKNOWN_NUMBER;
		m_sErrorID = WebTools.UNKNOWN_STRING;
	}

	public LinuxboxException(String msg) {
		super(msg);
		m_iExceptionType = WebTools.UNKNOWN_NUMBER;
		m_sErrorID = WebTools.UNKNOWN_STRING;
	}

	public LinuxboxException(int type, String errorID) {
		m_iExceptionType = type;
		m_sErrorID = errorID;
	}

	public LinuxboxException(int type, String errorID, String msg) {
		super(msg);
		m_iExceptionType = type;
		m_sErrorID = errorID;
	}

	public String getErrorID() {
		return m_sErrorID;
	}

	public int getExceptionType() {
		return m_iExceptionType;
	}
}
